// 获取assets静态资源
const getAssetsFile = (url) => {
  // 不能用@
  return new URL(`../assets/images/${url}`, import.meta.url).href
}
const require = (imgPath) => {
  try {
    const handlePath = imgPath.replace('@', '..')
    // https://vitejs.cn/guide/assets.html#the-public-directory
    return new URL(handlePath, import.meta.url).href
  } catch (error) {
    console.warn(error)
  }
}
export default {
  getAssetsFile,
  require,
}
